home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / general / hdf / unix / examples.lha / examples / sds / speed / C2FortSpeedF.f next >
Encoding:
Text File  |  1991-10-08  |  2.0 KB  |  78 lines

  1.  
  2. C************************************************************
  3. C
  4. C Test program: tests speed writing float data in three ways:
  5. C
  6. C                  1. to HDF SDS, default conversion
  7. C                  2. to HDF SDS, no conversion
  8. C                  3. to raw file, no conversion
  9. C
  10. C Note: in DFSDsettype routine, parameter #3 (DFNTF_CRAY), should
  11. C       be replaced when using other machines.  Currently, the
  12. C       only allowable replacement is 0. (July 1990)
  13. C
  14. C
  15. C Input files:  None.  The data is generated by the program.
  16. C Output files: Three files, named by the user on the command line.
  17. C
  18. C*********************************************************** */
  19.  
  20.  
  21.       program speedtst
  22.  
  23.       integer dssdims, dspdata, dsstype
  24.       integer ret, i, j, x, y
  25.       integer rank, dimsizes(2)
  26.       integer DFNTF_CRAY, DFNT_FLOAT, DFO_FORTRAN
  27.       real    data(1000,1000)
  28. C     integer time, tloc1, tloc2
  29.       character*8 buf
  30.  
  31.       data DFNTF_CRAY/3/, DFNT_FLOAT/5/, DFO_FORTRAN/1/
  32.  
  33.       x = 1000
  34.       y = 1000
  35.  
  36.       rank = 2
  37.       dimsizes(1) = x
  38.       dimsizes(2) = y
  39.  
  40.       do 110 i = 1, x
  41.         do 100 j = 1, y
  42.           data(i,j) = 10.0
  43.   100   continue
  44.   110 continue
  45.  
  46. C Write out scientific data set -- default conversion
  47.  
  48.       print *
  49.       call time(buf)
  50.       print *,'Before Default conversion: ',buf
  51.       ret = dssdims(rank, dimsizes)
  52.       ret = dspdata('fa',rank, dimsizes, data)
  53.       call time(buf)
  54.       print *,'After default conversion: ',buf
  55.       print *
  56.  
  57. C Write out scientific data set -- no conversions
  58.       call time(buf)
  59.       print *,'Before no conversion: ',buf
  60.       ret = dssdims(rank, dimsizes)
  61.       ret = dsstype(DFNT_FLOAT, 0, DFNTF_CRAY,  DFO_FORTRAN)
  62.       ret = dspdata('fb',rank, dimsizes, data)
  63.       call time(buf)
  64.       print *,'After no conversion: ',buf
  65.       print *
  66.  
  67. C Write out raw data to a file
  68.       call time(buf)
  69.       print *,'Before raw binary: ',buf
  70.       open(unit=10, file='fc', form='UNFORMATTED')
  71.       write(10)  data
  72.       call time(buf)
  73.       print *,'After raw binary: ',buf
  74.       print *
  75.  
  76.       end
  77.  
  78.